﻿using System;

namespace FDEE.Model
{
    /// <summary>
    /// 适用于盖梁下层主筋，非标准180度弯钩
    /// </summary>
    public class MURebarRecord : RebarBase
    {
        public MURebarRecord(int mBarMark, int sBarMark, string cBarMark, eDB diameter, int quantity, eShapeType shapeConfg,
            int aa, int bb, int cc, int bigR, int smallR       
            )
            : base(mBarMark, sBarMark, cBarMark, diameter, quantity, shapeConfg)
        {
            A = aa;
            B = bb;
            C = cc;
            R = bigR;
            r = smallR;
            d = PublicEnumItems.GeteDBData(diameter.ToString());
            if (r==0)
            {
                this.Formula = "L=A+B+C-R/2-d";
            }
            else
            {
                this.Formula = "L=A+B+C-R/2-r/2-2d";
            }

        }

        public override void SetLength()
        {
            if (r==0)
            {
                Length = Math.Round((A + B + C - R / 2 - d)* 0.001, 3, MidpointRounding.AwayFromZero);
            }
            else
            {
                Length = Math.Round((A + B + C - R / 2 - r / 2 - 2 * d) * 0.001, 3, MidpointRounding.AwayFromZero);
            }

        }
    }
}
